home *** CD-ROM | disk | FTP | other *** search
/ Aminet 43 / Aminet 43 (2001)(GTI - Schatztruhe)[!][Jun 2001].iso / Aminet / game / patch / WHDRockstarHam.lha / WHD_RockstarHamster / Install next >
Text File  |  2001-04-04  |  7KB  |  294 lines

  1. ;================================================================================
  2. ; CONFIGURATION SECTION
  3.  
  4. (set #CFG_APPNAME "Rockstar Ate My Hamster")
  5. (set #CFG_APPSLV  "RAMHHD")
  6. (set #CFG_APPGUI  "Rockstar Ate My Hamster")
  7. (set #CFG_APPVER  "R0401.1")
  8. (set #CFG_APPCOPY "2001")
  9.  
  10. ;================================================================================
  11.  
  12. ;------------------------------------------------------------------------------------
  13. ; Checks if given program is reachable via the path, if not abort install
  14. ;
  15. ; Entry:    #VP1 = name of program to search for
  16.  
  17. (procedure P_CheckRun (
  18.     (if (<> 0 (run (cat "Which " #VP1)))(
  19.         (abort
  20.             (cat
  21.                 "Could not find the program\n\n"
  22.                 "'" #VPROGRAM "'\n\n"
  23.                 "which is required to perform the installation!\n\n"
  24.                 "Please install the '" #VPROGRAM "' program ensuring that"
  25.                 " it is accessible on the path, then try the installation again."
  26.             )
  27.         )
  28.     ))
  29. ))
  30.  
  31.  
  32. ;------------------------------------------------------------------------------------
  33. ; Create installation directories if required
  34.  
  35. (procedure P_InstallDirs (
  36.     ;
  37.     ; Create data dir if required
  38.     ;
  39.     (if (<> 2 (exists #VDATDIR))(
  40.         (makedir #VDATDIR
  41.             (prompt "The directory '" #VDATDIR "' will now be created")
  42.             (help @makedir-help)
  43.             (confirm)
  44.         )
  45.     ))
  46. ))
  47.  
  48.  
  49. ;------------------------------------------------------------------------------------
  50. ; Determine and set information about version of game being installed
  51. ;
  52.  
  53. (procedure P_SetVersionInfo (
  54.     ; if the file exists, set version information
  55.     (if (< #VVERINFA 0)(
  56.         (if (= 1 (exists #VDATFILE))(
  57.             ; determine version from CRC
  58.             (working "Determining game version")
  59.  
  60.             (set #VT1
  61.                 (run (cat "CRC16 \"" #VDATFILE "\" OFFSET=0 LENGTH=5120"))
  62.             )
  63.  
  64.             (set #VVERINFA 0)
  65.             (if (= #VT1 26888) (set #VVERINFA 1))
  66.         ))
  67.     ))
  68. ))
  69.  
  70.  
  71. ;------------------------------------------------------------------------------------
  72. ; Make game data
  73.  
  74. (procedure P_InstallGame (
  75.     ;
  76.     ; Set path to game data file
  77.     ;
  78.     (set #VDATFILE (tackon #VDATDIR "RSTAR"))
  79.  
  80.     ;
  81.     ; Install data files if not found or unknown versions
  82.     ;
  83.     (P_SetVersionInfo)
  84.     (if (<= #VVERINFA 0)(
  85.         ;
  86.         ; Tell user what is happening
  87.         ;
  88.         (message
  89.             (cat
  90.                 "\n\n\nThe installer will now create the game data files\n"
  91.                 "Please insert your game disk in drive DF0:\n\n"
  92.                 "Click 'Proceed' when ready."
  93.             )
  94.         )
  95.  
  96.         ;
  97.         ; Call the imager slave
  98.         ;
  99.         (working "Creating data files in '" #VDATDIR "'")
  100.  
  101.         (copyfiles
  102.             (prompt "Copying game data file")
  103.             (help @copyfiles-help)
  104.             (source "DF0:RSTAR")
  105.             (dest #VDATDIR)
  106.             (optional fail force)
  107.         )
  108.     ))
  109.  
  110.     ;
  111.     ; Check the main data file was created and
  112.     ; that we know this version of the game
  113.     ;
  114.     (P_SetVersionInfo)
  115.  
  116.     (if (= 0 #VVERINFA)
  117.         (abort
  118.             (cat    "\n*** UNKNOWN VERSION OF GAME! ***\n\n"
  119.                     "The installer does not recognise the version of the\n"
  120.                     "game that you are trying to install.\n\n"
  121.                     "Please contact the author for further information\n"
  122.             )
  123.         )
  124.     )
  125.  
  126.     (if (= -1 #VVERINFA)
  127.         (abort
  128.             (cat    "\n*** DATA FILES NOT CREATED! ***\n\n"
  129.                     "The installer could not extract the game data files.\n\n"
  130.                     "Please contact the author for further information\n"
  131.             )
  132.         )
  133.     )
  134. ))
  135.  
  136. ;------------------------------------------------------------------------------------
  137. ; Install WHDLoad slave program
  138.  
  139. (procedure P_InstallSlave (
  140.  
  141.     (working "Installing slave program")
  142.  
  143.     ; copy slave program
  144.     (set #VT1 "Slave")
  145.     (if (>= #VVERINFA 0) (set #VT1 (cat #VT1 #VVERINFA)) )
  146.     (if (>= #VVERINFB 0) (set #VT1 (cat #VT1 #VVERINFB)) )
  147.     (if (>= #VVERINFC 0) (set #VT1 (cat #VT1 #VVERINFC)) )
  148.  
  149.     (copyfiles
  150.         (prompt "Copying slave program")
  151.         (help @copyfiles-help)
  152.         (source #VT1)
  153.         (newname #CFG_APPSLV)
  154.         (dest #VDESTDIR)
  155.         (nogauge)
  156.         (optional fail force)
  157.     )
  158.  
  159.     ; see if the user wants to replace their icon
  160.     (set #VT1 (cat #CFG_APPGUI ".info"))
  161.     (if (= 0 (exists (tackon #VDESTDIR #VT1)))(
  162.         ; no icon exists, quietly copy one in
  163.         (set #VT2 1)
  164.     )(
  165.         ; icon exists, ask user if they want to overwrite it
  166.         (set #VT2
  167.             (askbool
  168.                 (prompt (cat "Do you want to replace the \"" #CFG_APPGUI "\" program icon (recommended) ?"))
  169.                 (default 1)
  170.                 (help @askchoice-help)
  171.             )
  172.         )
  173.     ))
  174.  
  175.     ; do we have a slave icon?
  176.     (if (= 1 (exists "Slave.inf"))(
  177.         ; copy slave icon, renaming to proper name along the way
  178.         (if (= 1 #VT2)(
  179.             (copyfiles
  180.                 (prompt "Copying slave program icon")
  181.                 (help @copyfiles-help)
  182.                 (source "Slave.inf")
  183.                 (newname #VT1)
  184.                 (dest #VDESTDIR)
  185.                 (nogauge)
  186.                 (optional nofail force)
  187.             )
  188.         ))
  189.     )(
  190.         ; no slave icon so we must have a GUI to install
  191.         (copyfiles
  192.             (prompt "Copying GUI program")
  193.             (help @copyfiles-help)
  194.             (source  "GUI")
  195.             (newname #CFG_APPGUI)
  196.             (dest #VDESTDIR)
  197.             (nogauge)
  198.             (optional fail force)
  199.         )
  200.  
  201.         (if (= 1 #VT2)(
  202.             (copyfiles
  203.                 (prompt "Copying GUI program icon")
  204.                 (help @copyfiles-help)
  205.                 (source  "GUI.inf")
  206.                 (newname #VT1)
  207.                 (dest #VDESTDIR)
  208.                 (nogauge)
  209.                 (optional nofail force)
  210.             )
  211.         ))
  212.     ))
  213. ))
  214.  
  215. ;------------------------------------------------------------------------------------
  216. (welcome (cat "Welcome to the " #CFG_APPNAME " HD Installer"))
  217.  
  218. ;
  219. ; Initialise
  220. ;
  221. (set @app-name #CFG_APPNAME)
  222. (set #VOLDEXEDIR @execute-dir)
  223. (set #VVERINFA -1)
  224. (set #VVERINFB -1)
  225. (set #VVERINFC -1)
  226. (set #VDESTDIR @default-dest)
  227.  
  228. ;
  229. ; Check settings
  230. ;
  231. (if    (<> @user-level 2)
  232.     (abort "You must select 'Expert' user level")
  233. )
  234.  
  235. (if    (< @installer-version 2818051)
  236.     (abort "This product requires at least version 43.3 of the Installer program")
  237. )
  238.  
  239. ;
  240. ; Check required programs are available
  241. ;
  242. (set #VP1 "CRC16")
  243. (P_CheckRun)
  244. (set #VP1 "WHDLoad")
  245. (P_CheckRun)
  246.  
  247. ;
  248. ; Welcome message
  249. ;
  250. (message "\n\nWelcome to the " #CFG_APPNAME " HD Installer"
  251.          "\n© " #CFG_APPCOPY " John Girvin/Halibut Software\n\n"
  252.          "Please read the documentation thoroughly "
  253.          "before attempting to use this installer!\n\n"
  254.          "This is release " #CFG_APPVER "\n\n"
  255.          "Click 'Proceed' to begin..."
  256. )
  257.  
  258. ;
  259. ; Get directory to install in
  260. ;
  261. (set #VDESTDIR
  262.     (askdir
  263.         (prompt "Where would you like the game installed?\n"
  264.                 "If you have an existing installation select that directory,\n"
  265.                 "otherwise create / select the directory to install the game into."
  266.         )
  267.         (help @askdir-help)
  268.         (default @default-dest)
  269.         (disk)
  270.         (newpath)
  271.     )
  272. )
  273. (set #VDESTDIR (expandpath #VDESTDIR))
  274. (set @default-dest #VDESTDIR)
  275. (set #VDATDIR  (tackon #VDESTDIR "data/"))
  276.  
  277. ;
  278. ; Create the installation directories
  279. ;
  280. (P_InstallDirs)
  281.  
  282. ;
  283. ; Install the game data
  284. ;
  285. (P_InstallGame)
  286.  
  287. ;
  288. ; Install the slave
  289. ;
  290. (P_InstallSlave)
  291.  
  292. ;================================================================================
  293. ;$VER: Rockstar Ate My Hamster Installer script R0401.1 © 2001 John Girvin/Halibut Software;================================================================================
  294.